package com.zr.sms.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import com.zr.sms.service.SelectService;
import com.zr.sms.serviceimpl.SelectServiceImpl;

public class SelectGinventoryInfoServlet extends HttpServlet{
	SelectService s=new SelectServiceImpl();
     @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    		throws ServletException, IOException {
    	 doGet(req, resp);
    	 
    }
     @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
    		throws ServletException, IOException {
    	 resp.setCharacterEncoding("utf-8");
    	 int page=Integer.parseInt(req.getParameter("page"));
    	 int pagesize=Integer.parseInt(req.getParameter("rows"));
    	 int start=(page-1)*pagesize;
    	 int ginventory=50;
    	JSONObject jobj=s.getGinventoryInfos(start, pagesize, ginventory);
    	PrintWriter out =resp.getWriter();
    	out.write(jobj.toString());
    	 
    	 
    }
} 
